$(function () {

});

// 缴纳1元
$(document).on('click', '.recharge-btn', function () {
    var proxy = '',
        goodsId = Common.fn.getUrlParam('gid'),
        businessId = Common.fn.getUrlParam('bid');
    Common.fn.getUrlParam('proxy') ? proxy = Common.fn.getUrlParam('proxy') : proxy = 0;
    weui.confirm('确定要支付1元吗？', {
        title: '系统提示',
        buttons: [{
            label: '取消',
            type: 'default',
            onClick: function () {
                console.log('no')
            }
        }, {
            label: '支付',
            type: 'primary',
            onClick: function () {
                var result = Model.order.createOrder({
                    goodsId: goodsId,
                    proxyId: proxy
                });
                if (result.code) {
                    alert(result.message);
                    if(parseInt(result.code) == 10710) {
                        location.href = 'address.html';
                    }else {
                        location.reload();
                    }
                    return false;
                }
                alert(result.data);
                location.href = 'goods_detail.html?gid=' + goodsId + '&bid=' + businessId;
            }
        }]
    });
});